package customerEnter.Frame.JDBCDao.UseQuery;

import java.util.HashMap;
import java.util.Map;

import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.jdbc.support.rowset.SqlRowSetMetaData;

import customerEnter.Frame.DaoDataTransmission.DaoFramePameTransmission;
import customerEnter.Frame.JDBCDao.Interface.DaoFrameUseTypeInterface;

public class DaoFrameUseTypeMapImpl implements DaoFrameUseTypeInterface<Map<String, Object>> {

	@Override
	public <T, K> Map<String, Object> useDaoFrameDataType(DaoFramePameTransmission<T, K> daoFramePameTransmission) {
		SqlRowSet sqlRowSet = daoFramePameTransmission.sqlRowSet;
		SqlRowSetMetaData sqlRowSetMetaData = sqlRowSet.getMetaData();
		Map<String, Object> map = new HashMap<String, Object>();
		while (sqlRowSet.next()) {
			for (String string : sqlRowSetMetaData.getColumnNames()) {
				map.put(string, sqlRowSet.getObject(string));
			}
			break;
		}
		return map;
	}

}
